# -*- coding: utf-8 -*-
# @Time : 2021/2/3 上午 12:24
# @Author : lijunlong
# @Email : 729619494@qq.com
# @File : test_clientsearch_ture.py
# @Project : test0

from selenium.webdriver.common.by import By
from pages.base_page import BasePage

class ClientPage(BasePage):
    """定义客户页面"""
    url_ = "http://192.168.1.14/crm/index.php?m=customer"
    to_addclient_locator = (By.PARTIAL_LINK_TEXT,"新建客户")
    searchbutton_locator = (By.ID, "dosearch")
    bothaction_locator = (By.LINK_TEXT,"批量操作")
    bothaction_delete_locator = (By.ID,"delete")
    all_locator = (By.ID, "check_all")

    def to_addclient(self):
        self.findE(self.to_addclient_locator).click()

    def searchbutton(self):
        self.findE(self.searchbutton_locator).click()

    def bothaction(self):
        self.findE(self.bothaction_locator).click()

    def bothaction_delete(self,sleep): # 不宜封装多个动作，执行的时候会一起执行，网页容易来不及反应
        self.findE(self.all_locator).click()
        sleep(1)
        self.bothaction()
        self.findE(self.bothaction_delete_locator).click()

    def bothaction_delete_noall(self):
        """
        这里不包含勾选all
        """
        self.bothaction()
        self.findE(self.bothaction_delete_locator).click()

